package com.sunday.minio.entity;

import com.sunday.minio.utils.MinioUtils;
import io.minio.ObjectWriteResponse;
import lombok.Data;

/**
 * 单一写入响应
 *
 * @author zsy
 * @since 2023/10/16
 */
@Data
public class SingleWriteResponse extends BaseResult {

    public SingleWriteResponse(ObjectWriteResponse objectWriteResponse) {
        super(objectWriteResponse.bucket(), objectWriteResponse.object());
        this.objectWriteResponse = objectWriteResponse;
    }

    private ObjectWriteResponse objectWriteResponse;

    public String format() {
        return MinioUtils.format(this);
    }

    public static SingleWriteResponse of(ObjectWriteResponse objectWriteResponse) {
        return new SingleWriteResponse(objectWriteResponse);
    }

}
